import Vue from 'vue'
//导入vuerouter模块
import VueRouter from '../vuerouter'
import Home from '../views/Home.vue'

//函数：调用该函数；对象：调用对象的install方法
Vue.use(VueRouter)

//创建路由对象
const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home
  },
  {
    path: '/about',
    name: 'About',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
  }
]
// 构造函数、类，传入参数 形参options
const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
